/**
 * 
 */
package com.medical.service.essentialinfo.essentialinfoImpl;

import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.medical.mapper.essentialinfo.ServiceFacilityInfoMapper;
import com.medical.pojo.ServiceFacilityInfo;
import com.medical.service.ServiceFacilityInfoService;

/**
 * @author 冯鑫
 *	服务设施维护
 */
@Service
public class ServiceFacilityInfoServiceImpl implements ServiceFacilityInfoService {
	
	@Autowired
	private ServiceFacilityInfoMapper serviceFacilityInfoMapper;
	
	//增加设施
	@Override
	public int insertFacility(String encodingFacility, String facilityName, String chargeCategory,
			String limitTheScopeOfUse, String remark) {
		return serviceFacilityInfoMapper.insertFacility(encodingFacility, facilityName, chargeCategory, limitTheScopeOfUse, remark);
	}

	//删除设施
	@Override
	public int deleteFacility(String encodingFacility) {
		return serviceFacilityInfoMapper.deleteFacility(encodingFacility);
	}
	
	//修改设施信息
	@Override
	public int updateFacility(String facilityName, String chargeCategory, String limitTheScopeOfUse, String remark,
			String encodingFacility) {
		return serviceFacilityInfoMapper.updateFacility(facilityName, chargeCategory, limitTheScopeOfUse, remark, encodingFacility);
	}
	
	//通过设施名字模糊查找设施
	@Override
	public List<ServiceFacilityInfo> selectFacility(String chargeCategory) {
		return serviceFacilityInfoMapper.selectFacility(chargeCategory);
	}
	
	//全查询
	@Override
	public PageInfo selectAllFacility() {
		
		PageHelper.startPage(1, 3);
		List<ServiceFacilityInfo> list = serviceFacilityInfoMapper.selectAllFacility();
		for (ServiceFacilityInfo serviceFacilityInfo : list) {
			String id = UUID.randomUUID().toString();
			serviceFacilityInfo.setEncodingFacility("id");
		}
		PageInfo<ServiceFacilityInfo> pageInfo = new PageInfo<ServiceFacilityInfo>(list);
		
		return pageInfo;
	}

}
